#include <cstdio>
#include <queue>
#include <functional>
#include <string>
using namespace std;

priority_queue<long long, vector<long long>, greater<long long> > q;
string s, str;

int main() {
	int n;
	scanf("%d", &n);
	q.push(1);
	long long lastx = 0, x;
	while(1) {
		x = q.top();
		q.pop();
		if (x == lastx) {
			continue;
		}
		q.push(x * 4 + 5);
		q.push(x * 2 + 1);
		str = "";
		while (x > 0) {
			str = (char)(x % 10 + '0') + str;
			x /= 10;
		}
		s += str;
		if (s.size() >= n) {
			s.resize(n);
			break;
		}
	}
	printf("%s\n", s.c_str());
	return 0;
}